#include <iostream>
#include <cstring>

#include "hash.h"


void test_hash224()
{
    // OldHash hash(OldHash::SHA224_TYPE);
    // hash.Update("hello world", strlen("hello world"));
    // std::cout << "hash: 0x" << hash.Final() << std::endl;

    // auto t = hash.GetHash((const unsigned char*)"hello world", strlen("hello world"));
    // std::cout << "hash: 0x" << t << std::endl;


    Hash hash2(Hash::SHA224_TYPE);
    hash2.Update("hello world", strlen("hello world"));
    std::cout << "hash: 0x" << hash2.Final() << std::endl;

    auto t2 = hash2.GetHash(Hash::SHA224_TYPE, (const unsigned char*)"hello world", strlen("hello world"));
    std::cout << "hash: 0x" << t2 << std::endl;
}

void test_hash256()
{
    // OldHash hash(OldHash::SHA256_TYPE);
    // hash.Update("hello world", strlen("hello world"));
    // std::cout << "hash: 0x" << hash.Final() << std::endl;

    // auto t = hash.GetHash((const unsigned char*)"hello world", strlen("hello world"));
    // std::cout << "hash: 0x" << t << std::endl;


    Hash hash2(Hash::SHA256_TYPE);
    hash2.Update("hello world", strlen("hello world"));
    std::cout << "hash: 0x" << hash2.Final() << std::endl;

    auto t2 = hash2.GetHash(Hash::SHA256_TYPE, (const unsigned char*)"hello world", strlen("hello world"));
    std::cout << "hash: 0x" << t2 << std::endl;
}

void test_hash384()
{
    // OldHash hash(OldHash::SHA384_TYPE);
    // hash.Update("hello world", strlen("hello world"));
    // std::cout << "hash: 0x" << hash.Final() << std::endl;

    // auto t = hash.GetHash((const unsigned char*)"hello world", strlen("hello world"));
    // std::cout << "hash: 0x" << t << std::endl;


    Hash hash2(Hash::SHA384_TYPE);
    hash2.Update("hello world", strlen("hello world"));
    std::cout << "hash: 0x" << hash2.Final() << std::endl;

    auto t2 = hash2.GetHash(Hash::SHA384_TYPE, (const unsigned char*)"hello world", strlen("hello world"));
    std::cout << "hash: 0x" << t2 << std::endl;
}

void test_hash512()
{
    // OldHash hash(OldHash::SHA512_TYPE);
    // hash.Update("hello world", strlen("hello world"));
    // std::cout << "hash: 0x" << hash.Final() << std::endl;

    // auto t = hash.GetHash((const unsigned char*)"hello world", strlen("hello world"));
    // std::cout << "hash: 0x" << t << std::endl;


    Hash hash2(Hash::SHA512_TYPE);
    hash2.Update("hello world", strlen("hello world"));
    std::cout << "hash: 0x" << hash2.Final() << std::endl;

    auto t2 = hash2.GetHash(Hash::SHA512_TYPE, (const unsigned char*)"hello world", strlen("hello world"));
    std::cout << "hash: 0x" << t2 << std::endl;
}


int main(void)
{
    test_hash224();
    test_hash256();
    test_hash384();
    test_hash512();

    return 0;
}